package com.dlx.order.controller.api;

import com.dlx.common.result.Result;
import com.dlx.order.service.ConsumeOrderInfoService;
import com.dlx.vo.order.ConsumeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <h3>smms_parent</h3>
 *
 * @author nglon
 * @description <p>消费api</p>
 * @date 2021-11-28 14:31
 **/
@RestController
@RequestMapping("/api/order/consumeOrder")
public class ConsumeOrderInfoApiController {

    @Autowired
    private ConsumeOrderInfoService consumeOrderInfoService;

    @PostMapping("auth/consume")
    public Result consume(@RequestBody ConsumeVo consumeVo) {
        Boolean flag = this.consumeOrderInfoService.consume(consumeVo);
        return flag ? Result.ok("消费成功") : Result.fail("消费成功");
    }

    @GetMapping("getDiscount")
    public Result getDiscount(){
        return Result.ok(this.consumeOrderInfoService.getDiscount());
    }

}
